<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf8">
		<title>甜橙云音乐</title>
		<link href="{{ url_for('static',filename='css/pt_discover_index.css')}}" type="text/css" rel="stylesheet">
		<link href="{{ url_for('static',filename='css/pt_frame.css')}}" type="text/css" rel="stylesheet">
        <script type="text/javascript" src="{{url_for('static',filename='js/jquery-2.2.0.min.js')}}"></script>
        <script type="text/javascript" src="{{url_for('static',filename='js/layer/layer.js')}}"></script>
	</head>
	<body id="auto-id-X1gI20iWgxfCg0Tz">
		<div data-module="" data-sub="" id="g_top" class="m-top">
			&nbsp;
		</div>
		<div id="g_nav" class="m-subnav m-subnav-up f-pr">
			<div class="shadow">
				&nbsp;
			</div>
		</div>
		<div class="g-bd">
			<div class="g-wrap" id="baseBox">

				<ul class="m-tabs f-cb">
					<li class="fst">
						<a ><em>修改密码</em>
						</a>
					</li>
				</ul>
				<form onsubmit="return false;" action="">
					<div class="n-base f-cb">
						<div class="frm m-frm">

							<div class="itm">
								<span style="color:red">*</span>原密码：
                                <input type="password" class="u-txt txt" id="old_pwd"  name="old_pwd" maxlength="30">
							</div>
							<div class="itm">
								新密码：<input type="password"   class="u-txt txt" value="" id="new_pwd" name="new_pwd" maxlength="30">
							</div>
							<div class="itm">
								新密码确认：<input type="password" class="u-txt txt" id="re_pwd" name="re_pwd" maxlength="30">
							</div>
							<div class="itm ft">
                                <button name="submit" id="modify" >保存</button>
							</div>
						</div>
					</div>
				</form>
			</div>
		</div>
		<script
			src="//s3.music.126.net/sep/s/2/core.js?756557f5ea03745b332e7a7231d40984"
			type="text/javascript">
		</script>

		<script
			src="//s3.music.126.net/sep/s/2/pt_profile_update.js?7c50f062f581255b2ec534505774f597"
			type="text/javascript">
		</script>
<script>
    $('#modify').click(function(){
        var old_pwd = $('#old_pwd').val();
        var new_pwd = $('#new_pwd').val();
        var re_pwd = $('#re_pwd').val();
    	if(old_pwd==""){
			layer.msg("原密码不能为空！");
			return false;
		}
		if(new_pwd==""){
			layer.msg("新密码不能为空！");
			return false;
		}
		if(re_pwd==""){
			layer.msg("新密码确认不能为空！");
			return false;
		}
		if(re_pwd !== new_pwd ){
			layer.msg('密码前后不一致！');
			return false;
		}
		$.ajax({                                    // 使用Ajax异步提交
            url: "{{ url_for('home.modifyPassword') }}",   // 提交到的URL
            type: "POST",                            // 提交方式为GET
            data:{old_pwd:old_pwd,new_pwd:new_pwd},                 // 传递参数
            dataType: "json",                       // 数据类型为json
            success: function (res) {               // 操作成功后执行逻辑
                if (res.status == 1) {
                    layer.msg(res.message,{icon:1,time:1000},function(){
                        location.href = '/';
                    });
                } else {
                    layer.msg(res.message,{icon:2,time:2000});
                }
            }
        })
    })
</script>
	</body>
</html>
